
//渲染info信息到对应的页面元素
function renderInfo(res) {
    const {info} = res;
    if (info) {
        autoSetHtml(info);
    }
}

//请求配置的url获取到数据后
async function renderText(item) {
    let {data} = await axios.get(item.url);
    await item.renderInfo(data);
}

// console.enable = true;
// const clog = console.log;
// console.log = function (...args) {
//     if (!console.enable)
//         clog(...args);
// };


function autoSetHtml(info, parent) {
    for (let [key, value] of  Object.entries(info)) {
        if (parent) {
            $(`#${parent} #${key}`).html(value);
        } else {
            $(`#${key}`).html(value);
        }
    }
}

/*文本分解为碎片样式*/
function decorate(text) {
    var txt = (text + "").split("");
    var html = "";
    for (var i = 0; i < txt.length; i++) {
        html += `<span class="piece-text">${txt[i]}</span>`;
    }
    return html;
}

function onLayuiInit(...args) {

}